using System;
using System.Drawing;
using System.Web.UI;
using System.ComponentModel;
using System.Globalization;

namespace WebChart
{
	[TypeConverter(typeof(ExpandableObjectConverter)), PersistenceMode(PersistenceMode.InnerProperty)]
	public class ChartLegend
	{
		// Fields
		private ChartInterior background = new ChartInterior();
		private ChartLine border = new ChartLine(Color.Black);
		private Font font = ChartText.DefaultFont;
		private LegendPosition position;
		private short width = 100;

		// Methods
		public override string ToString()
		{
			return string.Format(CultureInfo.InvariantCulture, "{0}:{1}", new object[] { this.background.ToString(), this.border.ToString() });
		}

		// Properties
		[NotifyParentProperty(true), DefaultValue((string) null), Category("Appearance")]
		public ChartInterior Background
		{
			get
			{
				return this.background;
			}
			set
			{
				this.background = value;
			}
		}

		[NotifyParentProperty(true), DefaultValue((string) null), Category("Appearance")]
		public ChartLine Border
		{
			get
			{
				return this.border;
			}
		}

		[Category("Appearance"), NotifyParentProperty(true), DefaultValue(typeof(Font), "Tahoma, 8pt")]
		public Font Font
		{
			get
			{
				return this.font;
			}
			set
			{
				this.font = value;
			}
		}

		[DefaultValue(0), NotifyParentProperty(true), Category("Appearance")]
		public LegendPosition Position
		{
			get
			{
				return this.position;
			}
			set
			{
				this.position = value;
			}
		}

		[DefaultValue(typeof(short), "100"), Category("Appearance"), NotifyParentProperty(true)]
		public short Width
		{
			get
			{
				return this.width;
			}
			set
			{
				this.width = value;
			}
		}
	}
}
